// ==UserScript==
// @name          Google Notebook Quick Save
// @namespace     http://almaer.com/firefox/
// @description   Allow a user to shift+enter/return to save an entry
// @include       http://google.tld/notebook*
// ==/UserScript==

// Capture the keystroke
document.addEventListener("keypress", function(e) {
        if (e.shiftKey) {
                alert('shift key held');
                //xpath = "//div[@class='SaveControls']/input[@value='Save']"
                xpath = "//div[@class='SaveControls']"
                var saveControl = document.evaluate(xpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;

                alert(saveControl.id);
/*
                if (saveControl) {
                        alert(saveControl);
                }
*/
        }
}, false);

// Utility functions
function simulateClick(node, eventType) {
    var event = node.ownerDocument.createEvent("MouseEvents");
    event.initMouseEvent("mousedown",                         true, // can bubble
                         true, // cancellable
                         window,
                         1, // clicks
                         50, 50, // screen coordinates
                         50, 50, // client coordinates
                         false, false, false, false, // control/alt/shift/meta
                         0, // button,
                         node);    node.dispatchEvent(event);
}
